# -*- Coding = utf-8 -*-
# @time: 2021/2/1 16:29
# Author: YKL
from concurrent.futures.thread import ThreadPoolExecutor

import MySQLdb



def insert_data(start, end):
    conn = MySQLdb.connect(host='39.105.56.50', port=3306,
                           user='hellokitty', password='Hellokitty.618',
                           database='python2005', charset='utf8')
    with conn.cursor() as cursor:
        for index in range(start, end + 1):
            cursor.execute(
                'insert into tb_test1 (username, password) values (%s,%s)',
                (f'user{index}', '000000')
            )
    conn.commit()

def main():
    with ThreadPoolExecutor(max_workers=100) as pool:
        start, end = 1, 1000
        for _ in range(100):
            pool.submit(insert_data, start, end)
            start, end = end + 1, end + 1000

if __name__ == '__main__':
    main()